Skip to content

fix(provider-html-local): answer only the capture server's own loopback host - #472

Open
wjsoj wants to merge 2 commits into
hypit-ai:mainfrom
wjsoj:fix/html-local-host-check
Open

wjsoj wants to merge 2 commits into
hypit-ai:mainfrom
wjsoj:fix/html-local-host-check

Conversation

@wjsoj

@wjsoj wjsoj commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Closes #479

Problem

serveHtmlProgram binds 127.0.0.1 on an ephemeral port and serves the staged render directory (program HTML, project media, decoded source frames). It never checks the Host header. A web page whose own hostname is rebound to 127.0.0.1 (DNS rebinding) is then same-origin with the server and can read every staged file while a render is running.

Impact

Low. The attacker has to find the ephemeral port and complete a rebind within the render's lifetime. What leaks is the user's render material, not arbitrary files, because path containment is already enforced.

Reproduction (on origin/main)

Start serveHtmlProgram(dir) and request / with Host: attacker.example:<port>. The response is 200 with index.html.

Fix

Reply 421 Misdirected Request unless Host is exactly 127.0.0.1:<port>, the address the server hands to Chrome. The capture page and its source-frame URLs always use that URL, so rendering is unaffected.

Tests

  • New packages/provider-html-local/test/server.test.ts checks that the server's own host gets 200 and that attacker.example:<port> and localhost get 421. It fails on origin/main (200) and passes with the fix.
  • Real Chrome capture tests (HYPIT_BROWSER_TESTS=1, frames.test.ts and visual-readiness.test.ts, Chromium): 17/17 pass.
  • pnpm install --frozen-lockfile, pnpm check: pass.
  • pnpm test: 1148 tests, 1125 pass, 0 fail (23 skipped by environment gates).

Note: #421 touches the same file (range handling). The two changes are independent and should merge cleanly or with a trivial conflict.

wjsoj added 2 commits November 5, 2026 08:08
…ck host

The rendering server bound to 127.0.0.1 but served any Host header, so a
web page that rebinds its own name to 127.0.0.1 could read staged program
HTML, media and decoded frames while a render ran. Reply 421 unless the
request addresses the server by the URL it handed to Chrome.
…Host

A name that resolves to loopback but is not the server's own host, with or
without the port, must still get 421.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Local render server answers any Host header (DNS rebinding)

1 participant